package com.liu.netty.controller;


import com.liu.netty.entity.Senor;
import com.liu.netty.service.SenorService;
import entity.PageResult;
import entity.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import status.CodeEnum;

@RestController
@RequestMapping("/senor")
public class SenorController {

    @Autowired
    private SenorService senorService;


     @GetMapping
      public Result findSenor(@RequestParam(required = false) Integer page ,@RequestParam(required = false) Integer row ){
        Page<Senor> pageInfo =senorService.findPageSenor(page ,row);

        return  new Result(true , CodeEnum.OK.getCode(),"查询成功！！",new PageResult<Senor>((pageInfo.getTotalElements()),pageInfo.getContent()));
      }



}
